Crate umash[][src]

Expand description

UMASH is an almost-universal family of hash functions. Each Params struct defines a specific hash function; when the parameters are generated pseudorandomly, the probability that two different inputs of up to s bytes collide (for an independently generated set of parameters) is at most ceil(s / 4096) 2^-55 for the 64-bit hash. The 128-bit fingerprint reduces that probability to less than 2^-70 for inputs of 1 GB or less.

See the reference repo for more details and proofs.

Structs

A 128-bit Fingerprint is constructed by UMASH as if we had computed the UmashComponent::Hash and UmashComponent::Secondary functions, and stored them in the Fingerprint::hash array in order.

A Fingerprinter implements the 128-bit fingerprinting function defined by a specific Params struct, further tweaked by a seed. Construct Fingerprinters with Params::fingerprinter.

A Hasher implements one of the two hash 64-bit functions defined by a specific Params struct, further tweaked by a seed. Construct Hashers with Params::hasher, Params::secondary_hasher, or Params::component_hasher.

A Params stores a set of hashing parameters.

Enums

A given Params struct defines a pair of 64-bit hash functions. The UmashComponent::Hash is the primary hash value; we find a 128-bit fingerprint by combining that primary value with the UmashComponent::Secondary hash (in practice, it’s more efficient to compute both hash values concurrently, when one knows they want a fingerprint).